var API = API || {};

API.x_effect = {

    EffectsManager: function (mask_object) {

        var parent = this;
        var mask_obj = mask_object;
        var delayTime = 50;
        var dropScrollTime = 1300;

        this.execEffect = function (callback, args) {

            API.Data.IS_FILTERING = true;
            parent.callback = callback;

            var rand_num = delayTime + Math.floor(Math.random() * 501);

            $(mask_obj).mask(API.Data.lang['filter_filtering'] + "...");

            $.scrollTo(mask_obj, dropScrollTime, {onAfter: function () {

                window.setTimeout(function () {
                    if (parent.callback) {
                        parent.callback.apply(this, args || []);
                    }

                    $(mask_obj).unmask();

                    API.Data.IS_FILTERING = false

                }, rand_num);

            }
            });


        }

    }
};